package com.bky.service.impl;

import com.bky.model.OperateLog;
import com.bky.service.OperateLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @Author shipeilei
 * @Date Created on 2018/5/4
 */
@Service
public class OperateLogServiceImpl implements OperateLogService {
    @Autowired
    private MongoTemplate mongoTemplate;

    @Async("asyncExecutor")
    @Override
    public void save(OperateLog log) {
        System.out.println("async 添加系统操作日志，当前线程名称：" + Thread.currentThread().getName());
        mongoTemplate.save(log);
    }
}
